package com.szcinda.fitness.dto;

import com.szcinda.fitness.persistence.BodyMeasurement;
import com.szcinda.fitness.persistence.TrainMovement;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Data
public class DailyTrainDto implements Serializable {
    private String id;
    private LocalDate trainDate;
    private String openId;//作为学员的唯一标识
    private String trainNote;
    private List<String> trainPositions = new ArrayList<>();
    private List<String> trainTypes = new ArrayList<>();
    private List<TrainMovement> trainMovements = new ArrayList<>();
    private List<BodyMeasurement> bodyMeasurements = new ArrayList<>();

    public void convertPositions(String trainPositions) {
        if (trainPositions != null && trainPositions.length() > 0) {
            this.trainPositions.addAll(Arrays.asList(trainPositions.split(",")));
        }
    }

    public void convertTypes(String trainTypes) {
        if (trainTypes != null && trainTypes.length() > 0) {
            this.trainTypes.addAll(Arrays.asList(trainTypes.split(",")));
        }
    }
}
